home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2000 February / Macworld (2000-02).dmg / Updaters / WhiteCap 3.2.2.sea / WhiteCap 3.2.2 / WhiteCap Source / DirectX3 SDK / inc / d3drmdef.h < prev    next >
Text File  |  1996-08-28  |  14KB  |  404 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1995-1996 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       d3drm.h
  6.  *  Content:    Direct3DRM include file
  7.  *
  8.  ***************************************************************************/
  9.  
  10. #ifndef __D3DRMDEFS_H__
  11. #define __D3DRMDEFS_H__
  12.  
  13. #include <stddef.h>
  14. #include "d3dtypes.h"
  15.  
  16. #ifdef WIN32
  17. #define D3DRMAPI  __stdcall
  18. #else
  19. #define D3DRMAPI
  20. #endif
  21.  
  22. #if defined(__cplusplus)
  23. extern "C" {
  24. #endif
  25.  
  26. #ifndef TRUE
  27. #define FALSE 0
  28. #define TRUE 1
  29. #endif
  30.  
  31. typedef struct _D3DRMVECTOR4D
  32. {   D3DVALUE x, y, z, w;
  33. } D3DRMVECTOR4D, *LPD3DRMVECTOR4D;
  34.  
  35. typedef D3DVALUE D3DRMMATRIX4D[4][4];
  36.  
  37. typedef struct _D3DRMQUATERNION
  38. {   D3DVALUE s;
  39.     D3DVECTOR v;
  40. } D3DRMQUATERNION, *LPD3DRMQUATERNION;
  41.  
  42. typedef struct _D3DRMBOX
  43. {   D3DVECTOR min, max;
  44. } D3DRMBOX, *LPD3DRMBOX;
  45.  
  46. typedef void (*D3DRMWRAPCALLBACK)
  47.     (LPD3DVECTOR, int* u, int* v, LPD3DVECTOR a, LPD3DVECTOR b, LPVOID);
  48.  
  49. typedef enum _D3DRMLIGHTTYPE
  50. {   D3DRMLIGHT_AMBIENT,
  51.     D3DRMLIGHT_POINT,
  52.     D3DRMLIGHT_SPOT,
  53.     D3DRMLIGHT_DIRECTIONAL,
  54.     D3DRMLIGHT_PARALLELPOINT
  55. } D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE;
  56.  
  57. typedef enum _D3DRMSHADEMODE {
  58.     D3DRMSHADE_FLAT     = 0,
  59.     D3DRMSHADE_GOURAUD  = 1,
  60.     D3DRMSHADE_PHONG    = 2,
  61.  
  62.     D3DRMSHADE_MASK     = 7,
  63.     D3DRMSHADE_MAX      = 8
  64. } D3DRMSHADEMODE, *LPD3DRMSHADEMODE;
  65.  
  66. typedef enum _D3DRMLIGHTMODE {
  67.     D3DRMLIGHT_OFF      = 0 * D3DRMSHADE_MAX,
  68.     D3DRMLIGHT_ON       = 1 * D3DRMSHADE_MAX,
  69.  
  70.     D3DRMLIGHT_MASK     = 7 * D3DRMSHADE_MAX,
  71.     D3DRMLIGHT_MAX      = 8 * D3DRMSHADE_MAX
  72. } D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE;
  73.  
  74. typedef enum _D3DRMFILLMODE {
  75.     D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX,
  76.     D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX,
  77.     D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX,
  78.  
  79.     D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX,
  80.     D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX
  81. } D3DRMFILLMODE, *LPD3DRMFILLMODE;
  82.  
  83. typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
  84.  
  85. #define D3DRMRENDER_WIREFRAME   (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME)
  86. #define D3DRMRENDER_UNLITFLAT   (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID)
  87. #define D3DRMRENDER_FLAT        (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  88. #define D3DRMRENDER_GOURAUD     (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  89. #define D3DRMRENDER_PHONG       (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  90.  
  91. typedef enum _D3DRMTEXTUREQUALITY
  92. {   D3DRMTEXTURE_NEAREST,               /* choose nearest texel */
  93.     D3DRMTEXTURE_LINEAR,                /* interpolate 4 texels */
  94.     D3DRMTEXTURE_MIPNEAREST,            /* nearest texel in nearest mipmap  */
  95.     D3DRMTEXTURE_MIPLINEAR,             /* interpolate 2 texels from 2 mipmaps */
  96.     D3DRMTEXTURE_LINEARMIPNEAREST,      /* interpolate 4 texels in nearest mipmap */
  97.     D3DRMTEXTURE_LINEARMIPLINEAR        /* interpolate 8 texels from 2 mipmaps */
  98. } D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY;
  99.  
  100. typedef enum _D3DRMCOMBINETYPE
  101. {   D3DRMCOMBINE_REPLACE,
  102.     D3DRMCOMBINE_BEFORE,
  103.     D3DRMCOMBINE_AFTER
  104. } D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE;
  105.  
  106. typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL;
  107.  
  108. typedef enum _D3DRMPALETTEFLAGS
  109. {   D3DRMPALETTE_FREE,                  /* renderer may use this entry freely */
  110.     D3DRMPALETTE_READONLY,              /* fixed but may be used by renderer */
  111.     D3DRMPALETTE_RESERVED               /* may not be used by renderer */
  112. } D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS;
  113.  
  114. typedef struct _D3DRMPALETTEENTRY
  115. {   unsigned char red;          /* 0 .. 255 */
  116.     unsigned char green;        /* 0 .. 255 */
  117.     unsigned char blue;         /* 0 .. 255 */
  118.     unsigned char flags;        /* one of D3DRMPALETTEFLAGS */
  119. } D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY;
  120.  
  121. typedef struct _D3DRMIMAGE
  122. {   int width, height;          /* width and height in pixels */
  123.     int aspectx, aspecty;       /* aspect ratio for non-square pixels */
  124.     int depth;                  /* bits per pixel */
  125.     int rgb;                    /* if false, pixels are indices into a
  126.                                    palette otherwise, pixels encode
  127.                                    RGB values. */
  128.     int bytes_per_line;         /* number of bytes of memory for a
  129.                                    scanline. This must be a multiple
  130.                                    of 4. */
  131.     void* buffer1;              /* memory to render into (first buffer). */
  132.     void* buffer2;              /* second rendering buffer for double
  133.                                    buffering, set to NULL for single
  134.                                    buffering. */
  135.     unsigned long red_mask;
  136.     unsigned long green_mask;
  137.     unsigned long blue_mask;
  138.     unsigned long alpha_mask;   /* if rgb is true, these are masks for
  139.                                    the red, green and blue parts of a
  140.                                    pixel.  Otherwise, these are masks
  141.                                    for the significant bits of the
  142.                                    red, green and blue elements in the
  143.                                    palette.  For instance, most SVGA
  144.                                    displays use 64 intensities of red,
  145.                                    green and blue, so the masks should
  146.                                    all be set to 0xfc. */
  147.     int palette_size;           /* number of entries in palette */
  148.     D3DRMPALETTEENTRY* palette; /* description of the palette (only if
  149.                                    rgb is false).  Must be (1<<depth)
  150.                                    elements. */
  151. } D3DRMIMAGE, *LPD3DRMIMAGE;
  152.  
  153. typedef enum _D3DRMWRAPTYPE
  154. {   D3DRMWRAP_FLAT,
  155.     D3DRMWRAP_CYLINDER,
  156.     D3DRMWRAP_SPHERE,
  157.     D3DRMWRAP_CHROME
  158. } D3DRMWRAPTYPE, *LPD3DRMWRAPTYPE;
  159.  
  160. #define D3DRMWIREFRAME_CULL             1 /* cull backfaces */
  161. #define D3DRMWIREFRAME_HIDDENLINE       2 /* lines are obscured by closer objects */
  162.  
  163. typedef enum _D3DRMPROJECTIONTYPE
  164. {   D3DRMPROJECT_PERSPECTIVE,
  165.     D3DRMPROJECT_ORTHOGRAPHIC
  166. } D3DRMPROJECTIONTYPE, *LPD3DRMPROJECTIONTYPE;
  167.  
  168. typedef enum _D3DRMXOFFORMAT
  169. {   D3DRMXOF_BINARY,
  170.     D3DRMXOF_COMPRESSED,
  171.     D3DRMXOF_TEXT
  172. } D3DRMXOFFORMAT, *LPD3DRMXOFFORMAT;
  173.  
  174. typedef DWORD D3DRMSAVEOPTIONS;
  175. #define D3DRMXOFSAVE_NORMALS 1
  176. #define D3DRMXOFSAVE_TEXTURECOORDINATES 2
  177. #define D3DRMXOFSAVE_MATERIALS 4
  178. #define D3DRMXOFSAVE_TEXTURENAMES 8
  179. #define D3DRMXOFSAVE_ALL 15
  180. #define D3DRMXOFSAVE_TEMPLATES 16
  181.  
  182. typedef enum _D3DRMCOLORSOURCE
  183. {   D3DRMCOLOR_FROMFACE,
  184.     D3DRMCOLOR_FROMVERTEX
  185. } D3DRMCOLORSOURCE, *LPD3DRMCOLORSOURCE;
  186.  
  187. typedef enum _D3DRMFRAMECONSTRAINT
  188. {   D3DRMCONSTRAIN_Z,           /* use only X and Y rotations */
  189.     D3DRMCONSTRAIN_Y,           /* use only X and Z rotations */
  190.     D3DRMCONSTRAIN_X            /* use only Y and Z rotations */
  191. } D3DRMFRAMECONSTRAINT, *LPD3DRMFRAMECONSTRAINT;
  192.  
  193. typedef enum _D3DRMMATERIALMODE
  194. {   D3DRMMATERIAL_FROMMESH,
  195.     D3DRMMATERIAL_FROMPARENT,
  196.     D3DRMMATERIAL_FROMFRAME
  197. } D3DRMMATERIALMODE, *LPD3DRMMATERIALMODE;
  198.  
  199. typedef enum _D3DRMFOGMODE
  200. {   D3DRMFOG_LINEAR,            /* linear between start and end */
  201.     D3DRMFOG_EXPONENTIAL,       /* density * exp(-distance) */
  202.     D3DRMFOG_EXPONENTIALSQUARED /* density * exp(-distance*distance) */
  203. } D3DRMFOGMODE, *LPD3DRMFOGMODE;
  204.  
  205. typedef enum _D3DRMZBUFFERMODE {
  206.     D3DRMZBUFFER_FROMPARENT,    /* default */
  207.     D3DRMZBUFFER_ENABLE,        /* enable zbuffering */
  208.     D3DRMZBUFFER_DISABLE        /* disable zbuffering */
  209. } D3DRMZBUFFERMODE, *LPD3DRMZBUFFERMODE;
  210.  
  211. typedef enum _D3DRMSORTMODE {
  212.     D3DRMSORT_FROMPARENT,       /* default */
  213.     D3DRMSORT_NONE,             /* don't sort child frames */
  214.     D3DRMSORT_FRONTTOBACK,      /* sort child frames front-to-back */
  215.     D3DRMSORT_BACKTOFRONT       /* sort child frames back-to-front */
  216. } D3DRMSORTMODE, *LPD3DRMSORTMODE;
  217.  
  218. typedef DWORD D3DRMANIMATIONOPTIONS;
  219. #define D3DRMANIMATION_OPEN 0x01L
  220. #define D3DRMANIMATION_CLOSED 0x02L
  221. #define D3DRMANIMATION_LINEARPOSITION 0x04L
  222. #define D3DRMANIMATION_SPLINEPOSITION 0x08L
  223. #define D3DRMANIMATION_SCALEANDROTATION 0x00000010L
  224. #define D3DRMANIMATION_POSITION 0x00000020L
  225.  
  226. typedef DWORD D3DRMLOADOPTIONS;
  227.  
  228. #define D3DRMLOAD_FROMFILE  0x00L
  229. #define D3DRMLOAD_FROMRESOURCE 0x01L
  230. #define D3DRMLOAD_FROMMEMORY 0x02L
  231. #define D3DRMLOAD_FROMSTREAM 0x04L
  232.  
  233. #define D3DRMLOAD_BYNAME 0x10L
  234. #define D3DRMLOAD_BYPOSITION 0x20L
  235. #define D3DRMLOAD_BYGUID 0x40L
  236. #define D3DRMLOAD_FIRST 0x80L
  237.  
  238. #define D3DRMLOAD_INSTANCEBYREFERENCE 0x100L
  239. #define D3DRMLOAD_INSTANCEBYCOPYING 0x200L
  240.  
  241. typedef struct _D3DRMLOADRESOURCE {
  242.   HMODULE hModule;
  243.   LPCTSTR lpName;
  244.   LPCTSTR lpType;
  245. } D3DRMLOADRESOURCE, *LPD3DRMLOADRESOURCE;
  246.  
  247. typedef struct _D3DRMLOADMEMORY {
  248.   LPVOID lpMemory;
  249.   DWORD dSize;
  250. } D3DRMLOADMEMORY, *LPD3DRMLOADMEMORY;
  251.  
  252. typedef enum _D3DRMUSERVISUALREASON {
  253.     D3DRMUSERVISUAL_CANSEE,
  254.     D3DRMUSERVISUAL_RENDER
  255. } D3DRMUSERVISUALREASON, *LPD3DRMUSERVISUALREASON;
  256.  
  257.  
  258. typedef DWORD D3DRMMAPPING, D3DRMMAPPINGFLAG, *LPD3DRMMAPPING;
  259. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU = 1;
  260. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV = 2;
  261. static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT = 4;
  262.  
  263. typedef struct _D3DRMVERTEX
  264. {   D3DVECTOR       position;
  265.     D3DVECTOR       normal;
  266.     D3DVALUE        tu, tv;
  267.     D3DCOLOR        color;
  268. } D3DRMVERTEX, *LPD3DRMVERTEX;
  269.  
  270. typedef LONG D3DRMGROUPINDEX; /* group indexes begin a 0 */
  271. static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS = -1;
  272.  
  273. /*
  274.  * Create a color from three components in the range 0-1 inclusive.
  275.  */
  276. extern D3DCOLOR D3DRMAPI        D3DRMCreateColorRGB(D3DVALUE red,
  277.                                           D3DVALUE green,
  278.                                           D3DVALUE blue);
  279.  
  280. /*
  281.  * Create a color from four components in the range 0-1 inclusive.
  282.  */
  283. extern D3DCOLOR D3DRMAPI        D3DRMCreateColorRGBA(D3DVALUE red,
  284.                                                  D3DVALUE green,
  285.                                                  D3DVALUE blue,
  286.                                                  D3DVALUE alpha);
  287.  
  288. /*
  289.  * Get the red component of a color.
  290.  */
  291. extern D3DVALUE                 D3DRMAPI D3DRMColorGetRed(D3DCOLOR);
  292.  
  293. /*
  294.  * Get the green component of a color.
  295.  */
  296. extern D3DVALUE                 D3DRMAPI D3DRMColorGetGreen(D3DCOLOR);
  297.  
  298. /*
  299.  * Get the blue component of a color.
  300.  */
  301. extern D3DVALUE                 D3DRMAPI D3DRMColorGetBlue(D3DCOLOR);
  302.  
  303. /*
  304.  * Get the alpha component of a color.
  305.  */
  306. extern D3DVALUE                 D3DRMAPI D3DRMColorGetAlpha(D3DCOLOR);
  307.  
  308. /*
  309.  * Add two vectors.  Returns its first argument.
  310.  */
  311. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR d,
  312.                                           LPD3DVECTOR s1,
  313.                                           LPD3DVECTOR s2);
  314.  
  315. /*
  316.  * Subtract two vectors.  Returns its first argument.
  317.  */
  318. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorSubtract(LPD3DVECTOR d,
  319.                                                LPD3DVECTOR s1,
  320.                                                LPD3DVECTOR s2);
  321. /*
  322.  * Reflect a ray about a given normal.  Returns its first argument.
  323.  */
  324. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorReflect(LPD3DVECTOR d,
  325.                                               LPD3DVECTOR ray,
  326.                                               LPD3DVECTOR norm);
  327.  
  328. /*
  329.  * Calculate the vector cross product.  Returns its first argument.
  330.  */
  331. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorCrossProduct(LPD3DVECTOR d,
  332.                                                    LPD3DVECTOR s1,
  333.                                                    LPD3DVECTOR s2);
  334. /*
  335.  * Return the vector dot product.
  336.  */
  337. extern D3DVALUE                 D3DRMAPI D3DRMVectorDotProduct(LPD3DVECTOR s1,
  338.                                                  LPD3DVECTOR s2);
  339.  
  340. /*
  341.  * Scale a vector so that its modulus is 1.  Returns its argument or
  342.  * NULL if there was an error (e.g. a zero vector was passed).
  343.  */
  344. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorNormalize(LPD3DVECTOR);
  345. #define D3DRMVectorNormalise D3DRMVectorNormalize
  346.  
  347. /*
  348.  * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
  349.  */
  350. extern D3DVALUE                 D3DRMAPI D3DRMVectorModulus(LPD3DVECTOR v);
  351.  
  352. /*
  353.  * Set the rotation part of a matrix to be a rotation of theta radians
  354.  * around the given axis.
  355.  */
  356.  
  357. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorRotate(LPD3DVECTOR r, LPD3DVECTOR v, LPD3DVECTOR axis, D3DVALUE theta);
  358.  
  359. /*
  360.  * Scale a vector uniformly in all three axes
  361.  */
  362. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor);
  363.  
  364. /*
  365.  * Return a random unit vector
  366.  */
  367. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorRandom(LPD3DVECTOR d);
  368.  
  369. /*
  370.  * Returns a unit quaternion that represents a rotation of theta radians
  371.  * around the given axis.
  372.  */
  373.  
  374. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION quat,
  375.                                                               LPD3DVECTOR v,
  376.                                                               D3DVALUE theta);
  377.  
  378. /*
  379.  * Calculate the product of two quaternions
  380.  */
  381. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q,
  382.                                                           LPD3DRMQUATERNION a,
  383.                                                           LPD3DRMQUATERNION b);
  384.  
  385. /*
  386.  * Interpolate between two quaternions
  387.  */
  388. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q,
  389.                                                        LPD3DRMQUATERNION a,
  390.                                                        LPD3DRMQUATERNION b,
  391.                                                        D3DVALUE alpha);
  392.  
  393. /*
  394.  * Calculate the matrix for the rotation that a unit quaternion represents
  395.  */
  396. extern void             D3DRMAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D dmMat, LPD3DRMQUATERNION lpDqQuat);
  397.  
  398.  
  399. #if defined(__cplusplus)
  400. };
  401. #endif
  402.  
  403. #endif
  404.